#!/bin/sh
#
# resetDBSuperuserPassword.sh
#

if [ $# != 4 ];then
  echo "Usage: resetDBSuperuserPassword.sh controllerip coordip username password"
  exit 1;
fi

controllerip=$1
coordip=$2
username=$3
password=$4

su $username -c " ssh $controllerip \"psql -h $coordip -c \\\" alter user $username with password '$password'\\\" \" dilithium"

if [ $? -ne 0 ]; then
	exit 100
fi

exit 0
